from sqlalchemy import Column, Integer, String, DateTime, func, text
from forward.extend.sqlalchemy_sync import Base


class MerchantModel(Base):
    __tablename__ = "merchant"
    __table_args__ = {"comment": "商家"}

    id = Column(Integer, primary_key=True, autoincrement=True)
    name = Column(String(50), nullable=True, comment="商家名称")
    address = Column(String(50), nullable=True, comment="地址")
    contact_name = Column(String(32), nullable=True, comment="联系人姓名")
    contact_phone = Column(String(50), nullable=True)
    status = Column(Integer, nullable=True)
    salesman_id = Column(Integer, nullable=True, comment="销售人员id")
    created_time = Column(
        DateTime, nullable=True, server_default=func.now(), default=func.now()
    )
    created_at = Column(String(32), nullable=True)
    updated_time = Column(
        DateTime, nullable=True, default=func.now(), onupdate=func.now()
    )
    updated_at = Column(String(32), nullable=True)
    deleted_time = Column(Integer, nullable=True, onupdate=func.now())
    deleted_at = Column(String(32), nullable=True)
    is_deleted = Column(Integer, nullable=True, comment="是否删除", default=text("0"))
